<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/4/8
 * Time: 17:13
 */

namespace app\common\model;


use think\Model;
use think\Session;

class ExpLog extends Model
{

    /**写入经验获取日志
     * @param $type int 获取经验类型1发布话题2评论3管理员赠送
     * @param $exp int 经验值
     * @param $relation_id  int 关联ID
     */
    public function put_log($type,$exp,$relation_id){
        $data['type'] =$type;
        $data['exp'] = $exp;
        $data['relation_id'] = $relation_id;
        $data['add_time'] = date('Y-m-d H:i:s');
        $data['user_id'] = Session::get('user_info')['userid'];
        $this->save($data);
    }
    public function put_user_log($user_id,$type,$exp,$relation_id){
        $data['type'] =$type;
        $data['exp'] = $exp;
        $data['relation_id'] = $relation_id;
        $data['add_time'] = date('Y-m-d H:i:s');
        $data['user_id'] = $user_id;
        $this->save($data);
    }
}